<template>
  <div class="model-form">
    <el-page-header @back="goBack" content="增加">
    </el-page-header>
    <div class="model-content">
      <QueryForm   v-model="form"
                   @submit="createData"
                   @cancel="goBack"
                   ref="ruleForm"></QueryForm>
    </div>
  </div>
</template>

<script setup>
import {defineAsyncComponent, onMounted, ref} from "vue";
import {useCreate} from "@/uses/useCreate";
import {useRoute} from "vue-router";
import QueryForm from "./form.vue";


const form = ref({
  id: null,
  name: null,
  content: null,
  type: null,
  note: null,
  className:null,
  queryType:null,
  permission:null,
  extData: {
    filters:[]
  },
  sqlBatchObject:{
    sqlObjects:[]
  }
})


const ruleForm = ref(null);


const route = useRoute()
onMounted(()=>{
  console.log(route.params)
  if (route.query.catalog){
    form.value.queryCatalog=parseInt(route.query.catalog);
  }

})


const {createData,goBack} =useCreate("queryTemplate",form,ruleForm)
// 处理表单提交


</script>

<style scoped>
</style>
